import Vue from 'vue'
import App from './App.vue'
import router from './config/router.js'
// import Antd from 'ant-design-vue';
import {
    message
} from 'ant-design-vue'
import install from './config/install.js'
//调用use，会调用install.js中的install方法，逐个遍历组件进行全局注册
Vue.use(install)
import 'ant-design-vue/dist/antd.css';
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
import scoket from "vue-socket.io"; // 引入组件
Vue.config.productionTip = false;
Vue.prototype.$message = message
Vue.prototype.$img = function(img) {
    return 'http://139.196.163.92:3000/images/' + img
}
// 判断字符串字符长度
String.prototype.gblen = function() {
    var len = 0;
    for (var i = 0; i < this.length; i++) {
        if (this.charCodeAt(i) > 127 || this.charCodeAt(i) == 94) {
            len += 2;
        } else {
            len++;
        }
    }
    return len;
}
// 点击页面中的任意位置 方法
Vue.prototype.globalClick = function(callback) {
    document.onclick = function() {
        callback();
    };
};
Vue.use(mavonEditor) //使用md插件
Vue.use(new scoket({
    debug: true, // 开启提示
    connection: 'http://localhost:3000', // 后台服务地址
}))
new Vue({
    el: '#app',
    // components: {
    //     App
    // },
    router,
    render: h => h(App),
})